﻿using System;
using System.Web.UI;
using QzEbook.Admin;
using QzEbook.BaseView;
using QzEbook.AccessObject;

namespace qzEbook.module
{
    public partial class updatePwd : System.Web.UI.UserControl
    {
        UserPage userpage;
        protected void Page_Load(object sender, EventArgs e)
        {
            userpage = this.Page as UserPage;
        }
        protected void UpDateUserBtn_Click(object sender, EventArgs e)
        {
            SessionUser userSession=Session["User"] as SessionUser;
            string oldpwd=oldPwdTb.Text.Trim();
            string newPwd=newPwdTb.Text.Trim();
            string rePwd=rePwdTb.Text.Trim();

            if (oldpwd.Length < 6 || newPwd.Length < 6 || newPwd != rePwd)
            {
                userpage.alert("不符合密码规范");
                return;
            }

            bool action=userSession.ChangePassWord(newPwd, oldpwd);
            if (action)
            {
                userpage.alert("更新成功");
            }
            /*是否更新到数据库*/

        }
}
}